                <!-- table -->
				<div class="box">
					<!-- box / title -->
					<div class="title">
						<h5>
                            <?=$title;?>
                            <?php if($month!='-')
                                echo 'Periode '.month_name($month);
                            ?>
                        </h5>
						<div class="search">
                        <?php if($month!='-'): ?>
                            <?=form_open('billing-ar/printing/getGasConsumptionExport')?>
								<div class="input">
                                    <label class="search"><?=lang('export')?></label>
									<?=form_dropdown('export',config('export'))?>
								</div>
								<div class="button">
									<?=form_submit('submit',lang('export'))?>
								</div>
							<?=form_close()?>
                        
                        <?php else:?>
                            <?=form_open('billing-ar/printing/getGasConsumption')?>
								
                                <div class="input">
                                    <?=form_dropdown('month',config('month'),date('m'))?>
                                    <?=form_dropdown('year',config('year'),date('Y'))?>
								</div>
     
                                <div class="input">
									<?=form_dropdown('customer',$customers,'','style="width:150px"')?>
								</div>
								<div class="button">
									<input type="submit" name="submit" value="Search" />
								</div>
							<?=form_close()?>
                         <?php endif;?>   
						</div>
					</div>
					<!-- end box / title -->
					<div class="table">
                    
                        <?php if($this->session->flashdata('success')):?>
						<div id="message-success" class="message message-success">
							<div class="image">
								<img src="resources/images/icons/success.png" alt="Success" height="32" />
							</div>
							<div class="text">
								<h6>Send Email</h6>
								<span>Send Email Success to Recipient , to Edit email set to Settings Menu !</span>
							</div>
							<div class="dismiss">
									<a href="#message-success"></a>
							</div>
						</div>
						<?php elseif($this->session->flashdata('error')):?>
						<div id="message-error" class="message message-error">
								<div class="image">
									<img src="resources/images/icons/error.png" alt="Error" height="32" />
								</div>
								<div class="text">
									<h6>Send Email</h6>
									<span>Send Email Error to Recipient , to Edit email set to Settings Menu !</span>
								</div>
								<div class="dismiss">
									<a href="#message-error"></a>
								</div>
						</div>
						<?php endif;?>
                        
                        <?php if((COUNT($customerData)) && (COUNT($ghv)) ):?>
						<table>
                            <thead>
                                <tr>
                                    <th style="text-align: left;" colspan="2"><p>CONTRACT DATA</p></th>
                                </tr>
                                <tr style="text-align: right;">
                                    <th class="price"><p>PJBG. No</p></th>
                                    <td class="title"><p><?='x'.$pjbg['Nomor']?></p></td>
                                </tr>
                                <tr style="text-align: right;">
                                    <th><p>Letter No</p></th>
                                    <td class="title"><p><?=$pjbg['Ref']?></p></td>
                                </tr> 
                                <tr style="text-align: right;">
                                    <th><p>Customer ID No</p></th>
                                    <td class="title"><p><?=$customerData['MataAnggaran']?></p></td>
                                </tr>
                                <tr style="text-align: right;">
                                    <th><p>Company Name</p></th>
                                    <td class="title"><p><?=$customerData['Perusahaan']?></p></td>
                                </tr>
                                <tr style="text-align: right;">
                                    <th><p>Min Contract Vol</p></th>
                                    <td class="title"><p><?=decimal($pjbg['MinContract'],0)?> Sm3/month</p></td>
                                </tr>
                                <tr style="text-align: right;">
                                    <th><p>Max Contract Vol</p></th>
                                    <td class="title"><p><?=decimal($pjbg['MaxContract'],0)?> Sm3/month</p></td>
                                </tr>
                                <tr style="text-align: right;">
                                    <th><p>Max Excess Vol</p></th>
                                    <?php $excess0= ($pjbg['Excess']/100) * $pjbg['MaxContract'];
                                          $excess = $pjbg['MaxContract'] + $excess0; ?>
                                    <td class="title"><p><?=decimal($excess,0)?> Sm3/month</p></td>
                                </tr>
                            </thead>
                        </table>
                        
                        <table>
                            <thead>
                                <tr>
                                    <th style="text-align: left;" colspan="3"><p>LABORAT DATA</p></th>
                                </tr>
                                <?php 
                                $week =  1;
                                $total = 0;
                                foreach($ghv as $ghv):?>
                                <tr>
                                    <th><?='Week '.$week?>:</th>
                                    <td style="text-align: right;"><?=decimal($ghv['GHV'],4)?></td>
                                    <td>Btu/scf</td>
                                </tr>
                                <?php
                                $week++;
                                $total = $total + $ghv['GHV'];
                                endforeach;?>
                                <tr>
                                    <th><?='Average'?>:</th>
                                    <td style="text-align: right;"><?=decimal($avg=$total/($week-1),4)?></td>
                                    <td>Btu/scf</td>
                                </tr>
                             </thead>
                         </table>  
                         <?php
                            $x     = $avg*35.31466672;
				            $mmbtu = 1000000/$x;
                         ?>
                         
                        <table>	
    						<thead>
                                <tr>
        							<th style="text-align: left;" colspan="4"><p>CONVERSION</p></td>
        						</tr>
        						<tr>
        							<td>1m</td>
        							<td>=</td>
        							<td class="right">3.280839895</td>
        							<td>ft</td>
        						</tr>
						<tr>
							<td>1m3</td>
							<td>=</td>
							<td class="right" >35.31466672</td>
							<td>ft3 (scf)</td>
						</tr>
						<tr>
							<td>1 MM</td>
							<td>=</td>
							<td class="right">1,000,000</td>
							<td></td>
						</tr>
						<tr>
							<td><strong>1 MMBTU</strong></td>
							<td>=</td>
							<td class="right"><strong><?=$mmbtu?></strong></td>
							<td><strong>Sm3</strong></td>
						</tr>
                        </thead>
					</table>
                    
                    <table>	
    						<thead>
                                <tr>
        							<th style="text-align: left;" colspan="4"><p>GAS CONSUMPTION</p></td>
        						</tr>
        						<tr>
					               <th colspan="4"><strong>Volume Data (Sm3)</strong></th>					 
				                </tr>
                				<tr>
                					<th><strong>Periode</strong></th>
                					<th><strong>Last Month</strong></th>
                					<th><strong>This Month</strong></th>
                					<th><strong>Vol. Used</strong></th>
                				</tr>
                                <?php
                                    $use = 0;
                                    foreach($metering as $row_metering):
                                 ?>
                                <tr>
                					<td><?=$row_metering['ItemLine']?></td>
                					<td><?=number_format($row_metering['Meteran_Awal'],0,'.',',')?></td>
                					<td><?=number_format($row_metering['Meteran_Akhir'],0,'.',',')?></td>
                					<td><?=number_format($row_metering['Pemakaian'],0,'.',',')?></td>
                				</tr>
                                <?php
                                    $use = $use + $row_metering['Pemakaian'];
                                    endforeach;
                                ?>
                                <tr>
                					<td colspan="3"><strong><?=lang('total')?></strong></td>
                					<td><?=number_format($use,0,'.',',')?></td>
                				</tr>
						        
                             </thead>
                     </table>
                     
                     <table>	
    						<thead>
                                <tr>
					               <th colspan='5'><p>MONTHLY GAS USED</p></th>					 
				                </tr>
                                <tr>
					               <th></th>
                                  <?php foreach($line as $mmbtu): ?>
                                        <th><?=$mmbtu['Keterangan']?></th>
                                    <?php endforeach;?>
                                   <th>Total Quantity</th>
                                </tr>   
                                <tr>
                                    <th><strong>MMBTU</strong></th>
                                    <?php 
                                    $mmbtux = 0;
                                    foreach($line as $mmbtu): ?>
                                    <td class="right"><?=decimal($mmbtu['pemakaian_mmbtu'],2)?></td>
                                    <?php 
                                    $mmbtux = $mmbtux + $mmbtu['pemakaian_mmbtu'];
                                    endforeach;?>
                                    <td class="right"><?=decimal($mmbtux,2)?></td>
                                </tr>
                                
                                <tr>
                                    <th><strong>Sm3</strong></th>
                                    <?php 
                                    $mmbtuxx = 0;
                                    foreach($line2 as $mmbtu2): ?>
                                    <td class="right"><?=decimal($mmbtu2['pemakaian_m3'],2)?></td>
                                    <?php 
                                    $mmbtuxx = $mmbtuxx + $mmbtu2['pemakaian_m3'];
                                    endforeach;?>
                                    <td class="right"><?=decimal($mmbtuxx,2)?></td>
                                </tr>
        					</thead>     
                     </table>
                     <?php endif;?>   
                        
                        <?php if($month!='-'):?>
                        <div class="action">
                            <?=anchor('billing-ar/printing/getGasConsumptionReset','Kembali Ke Awal');?>
			         	</div>
                        <?php endif;?>
                        
					</div>
				</div>
				<!-- end table -->